import { Component } from 'vue-facing-decorator'
import Render from '@/render/Render'
import toNative from '@/utils/toNative'
import TableRender from '@/render/TableRender'
import { Button, } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
import renderModal, {
    getModelValue,
    initModelValue,
    renderForm,
    type FormModalDto
} from '@/components/modal/Modal'
@Component
export class SystemView extends TableRender {
    renderHead() { 
        return (
            <div class="flex items-center justify-between px-24 pt-20">
                <div class="text-black-light-200 text-lg font-semibold">代理商系统</div>
                <Button type="primary" onClick={() => { this.onOpenAddPop()}}>
                    <PlusOutlined />
					新增代理商
                </Button>
            </div>
        )
    }
	
    formConfig = this.initFormConfig() as FormModalDto
    initFormConfig() { 
        return {
            title: '',
            width: '400px',
            theme: 'light',
            show: false,
            items: {
                companyId: {
                    name: '报案公司',
                    element: 'select',
                    placeholder: '请输入报案公司名称',
                    optionsType: 'company',
                    required: true
                },
            },
            complete: async () => {},
            cancel: () => {},
        }
    }

    tableColumnConfigOld = () => [
        {
            field: 'id',
            title: '推送账户',
        },
        {
            field: 'id',
            title: '系统名称',
        },
        {
            field: 'id',
            title: '开通产品',
        },
        {
            field: 'id',
            title: '对接方式',
        },
        {
            field: 'id',
            title: '工种审核',
        },
        {
            field: 'id',
            title: '状态',
        },
        {
            field: 'id',
            title: '开户时间',
        }
    ]
	
    onOpenAddPop() {
        // 暂时做调整detail方法
        this.$router.push({
            path: '/agent/system/200',
        })
        return
        this.formConfig.show = true
        console.log(this.formConfig,'点击了')
    }
	
    render() { 
        return (
            <div class="flex flex-col h-full">
                <div class="flex-none">{this.renderHead()}</div>
                <div class="flex-1">
                    {this.renderTable()}
                </div>
                <div class="flex-none">{this.renderPager()}</div>
                { renderModal(this.formConfig) }
            </div>
        )
    }
}

export default toNative<{}, {}>(SystemView)